<?php
  class buffer{   public $arr;
   protected $buffer;
   protected $name;
   function __construct($filename=""){   	if(file_exists($filename)){
    $this->buffer.=join(" ",file(SITE_DIR.$filename));
    }
   }

   function data($str=""){   	if($str !=""){   	 $this->buffer.=$str;   	 }else{   	  return $this->buffer;
     };
   }

	function parse($arr=""){	 if (is_array($arr)){	  foreach ( $arr as $key=>$value)
       $this->buffer=str_replace("{".$key."}",$value,$this->buffer);
     }
	}

	function show(){	 $tmp=$this->buffer;
	 $this->buffer="";
	 print($tmp);
	}

 	function view($filename, $arr="",$arg=false){
 	 if(file_exists($filename) ){      if($this->cash($filename));

      	$this->buffer=join(" ",file(SITE_DIR.$filename));

      if(is_array($arr))$this->parse($arr);
      if($arg !=1){       $this->show();
       }else{        return  $this->buffer;
       }
 	 }
 	}

 	function cash($filename){

 	}


 }
?>